home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Macintosh Tracker 1.20 / source / Tracker Client Folder / Core 18⁄March⁄1994 / Utilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-02  |  2.1 KB  |  92 lines  |  [TEXT/KAHL]

  1. /* Utilities.h */
  2.  
  3. #pragma once
  4.  
  5. /* utility functions and stuff & Definitions */
  6. /* this file contains useful type definitions and utility functions */
  7.  
  8. #define True (0 == 0)
  9. #define False (0 != 0)
  10. typedef short MyBoolean;
  11.  
  12. /* some useful typedefs */
  13. #define NIL (0L)
  14. typedef    unsigned long  ulong;
  15. typedef unsigned short  ushort;
  16. typedef unsigned char  uchar;
  17. typedef    uchar  PString[256];
  18. typedef struct {long Numerator; long Denominator;} Ratio;
  19.  
  20. typedef struct
  21.     {
  22.         long    x;
  23.         long    y;
  24.     } LongPoint;
  25.  
  26.  
  27. /* memory utilities */
  28.  
  29. /* a better MEMCPY. */
  30. void            MemCpy(char* Target, char* Source, signed long NumBytes);
  31.  
  32. /* memory compare */
  33. MyBoolean    MemEqu(char* First, char* Second, long NumBytes);
  34.  
  35. /* the labs function */
  36. long            LAbs(long value);
  37.  
  38. /* number of chars in a C string */
  39. long            StrLen(char* It);
  40.  
  41.  
  42. /* string utilities */
  43.  
  44. /* get a string from the resource file stored as a C string */
  45. Handle        GetCString(ulong StringID);
  46.  
  47. /* make a handle string out of a C string constant */
  48. Handle        CString2Handle(char* String);
  49.  
  50. /* make a handle string out of a Pascal string constant */
  51. Handle        PString2Handle(PString String);
  52.  
  53. /* make a Pascal string out of a handle */
  54. void            Handle2PString(Handle Source, PString PlaceToPut);
  55.  
  56. /* concatenate strings (the two original strings remain valid) */
  57. Handle        HStrCat(Handle First, Handle Second);
  58.  
  59. /* compare two strings */
  60. short            HStrCmp(Handle First, Handle Second);
  61.  
  62. /* duplicate a string */
  63. Handle        HDuplicate(Handle Original);
  64.  
  65. /* make a handle out of data */
  66. Handle        HandleOf(char* Data, long NumBytes);
  67.  
  68. /* convert a real number to a string handle (with no length delimitors) */
  69. Handle        Real2String(long double Value, char Mode, short Digits);
  70.  
  71. /* convert a string to a real number */
  72. long double        String2Real(Handle StringHandle);
  73.  
  74. /* convert a long integer to a string handle */
  75. Handle        Int2String(long TheInt);
  76.  
  77. /* convert a string to an integer */
  78. long            String2Int(Handle StringHand);
  79.  
  80.  
  81. /* hex utilities */
  82.  
  83. /* convert a hexadecimal character into a byte value */
  84. char            Hex2Byte(char Hex);
  85.  
  86. /* convert a byte to a hexadecimal character */
  87. char            Byte2Hex(char Value);
  88.  
  89.  
  90. #include "Debug.h"
  91. #include "Audit.h"
  92.